import numpy as np

# stock_cnt = 200
# view_days = 504
# stock_day_change = np.random.standard_normal((stock_cnt, view_days))
# print(stock_day_change.shape)
# print(stock_day_change[0:1, :5])

# 并行化思想
# np_1 = np.array(list(range(10)))
# print(np_1 + 10)
# print(np_1 * 10)
# print(np_1 - 10)

# np_2 = np.full((3,3), 1.0, dtype=float)
# print(np_2 + 10)
# print(np_2 * 20)

# np_3 = np.linspace(0, np.pi, 20)
# np_4 = np.sin(np_3)
# print(np_4)

# np_5 = sum([1,2,3,4,5])
# print(np_5)

#二维数组将对列进行求和
# np_6 = np.array([[1,2],[3,4]])
# print(sum(np_6))
# print(np.sum(np_6))
# print(np.sum(np_6, axis=1)) # axis=1对行求和 axis=0对列求和
# print(np.max(np_6))

# 批量并行操作思想
# np_7 = np.array(range(10))
# print(np_7>3)
# print(np.all(np_7>3))
# print(np.any(np_7>3))

# 200只股票
stock_cnt = 200
# 504个交易日
view_days = 504
# 生成服从正态分布：均值期望二0，标准差二1的序列
# 200行504列的矩阵,每一行代表一只股票,每一列代表一个交易日
stock_day_change = np.random.standard_normal((stock_cnt, view_days))
# 打印shape (200, 504) 200行504列
# print(stock_day_change.shape)
# 打印出第一只股票，前5个交易日的涨跌幅情况
# print(stock_day_change[0:1, :5])
#-2:倒数第一只、第二只股票,-5:最后5个交易日的涨跌幅数据
# print(stock_day_change[-2:, -5:])

# tmp = stock_day_change[0:2, 0:5].copy()

print(stock_day_change[0:2, 0:5])
stock_day_change[0:2, 0:5].astype(int)
# np.round(stock_day_change[0:2, 0:5], 2)
print(np.round(stock_day_change[0:2, 0:5], 2))
